#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
const int N = 1e5 + 10;
string s;
int n;
int main()
{
	cin >> n >> s;
	int ans = 0;
	int cnt_0 = 0, cnt_1 = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '0') {
			cnt_0++;
		}
		else {
			cnt_1++;
			if (s[i + 1] == '0' || i == n - 1) {
				ans = max(ans, min(cnt_0, cnt_1));
				cnt_1 = 0;
			}
		}
	}
	cout << ans * 2 << endl;
	return 0;
}